package info.nixbear.tgcms.admin.server;

import info.nixbear.tgcms.admin.client.AdminRemoteService;

import java.util.ArrayList;
import java.util.List;

import com.google.appengine.api.blobstore.BlobstoreService;
import com.google.appengine.api.blobstore.BlobstoreServiceFactory;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class AdminRemoteServiceImpl extends RemoteServiceServlet implements AdminRemoteService {
	
	private static final long serialVersionUID = -2137187388797561399L;
	
	private BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();
	
	public List<String> getBlobstoreUploadUrls(String key, int number) throws IllegalArgumentException {
		List<String> list = new ArrayList<String>(number);
		for(int i = 0; i < number; i++) {
			list.add(blobstoreService.createUploadUrl("/admin/upload"));
		}
		return list;
	}
	
}
